<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <router-link to="/home">首页</router-link>
        <router-link to="/box/123">公司介绍</router-link>
        <router-link to="/pox/456">食品安全</router-link>
        <router-view></router-view>
    </div>
</body>
<script src="../vue-demos/node_modules/vue/dist/vue.js"></script>
<script src="../vue-demos/node_modules/vue-router/dist/vue-router.js"></script>
<script>
    let routes = [
        {
            path: "/home",
            component: () => Promise.resolve({
                template: `<h1>主页</h1>`
            })
        },
        {
            path: "/box/:boxId",
            component: () => import("./product.js")
        },
        {
            path:"/pox/",
            component: () => Promise.resolve({
                template: `<h1>hello</h1>`

            })
        } 
    ]   
    let router = new VueRouter({
        routes
    })
    let vm = new Vue({
        router,
        el: "#app"
    })
</script>

</html>